<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    input{
        width: 50px;
        height: 30px;
    }
</style>
<body>
<input type="button" value="0"><br><br>
<input type="button" value="0"><br><br>
<input type="button" value="0">
<script>
    var links=document.getElementsByTagName("input");
    var arr=["A","B","C","D"];
    for(var i=0;i<links.length;i++){
        links[i].val=0;
        links[i].onclick=function(){
            this.value=arr[(this.val++)%4];
        }
    }
</script>
</body>
</html>